import Vue from 'vue'
import App from './App.vue'
import router from './router'
Vue.config.productionTip = false

//element UI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

//设置全局变量
import domain from './components/Global.vue';
Vue.prototype.GLOBAL = domain

//设置axios 全局请求
import axios from 'axios'
Vue.prototype.axios = axios
if(window.localStorage.getItem('username')){
	axios.defaults.headers.common['Authorization'] = window.localStorage.getItem('username');	
}

axios.interceptors.response.use(
	response => {
	  return response
	},
	error => {
		if(error.response){
			if(error.response.status == 401){
				console.log(router);
			}	
		}
	}
)
Vue.use(ElementUI);

new Vue({
	router,
	render: h => h(App)
}).$mount('#app')
